package com.yin.myproject.design.proxydesign;

import java.lang.reflect.Proxy;

/**
 * @author Eason
 * @create 2018-05-03 22:33
 **/
public class DynamicClient {
    public static void main(String[] args) {
        ILitigation plaintiff = new Plaintiff();
        ILitigation defendant = new Defendant();
        ILitigation plaintiffProxy = (ILitigation) Proxy.newProxyInstance(DynamicClient.class.getClassLoader(), new Class[]{ILitigation.class}, new LawerProxyHandler(plaintiff));
        ILitigation defendantProxy = (ILitigation) Proxy.newProxyInstance(DynamicClient.class.getClassLoader(), new Class[]{ILitigation.class}, new LawerProxyHandler(defendant));
        plaintiffProxy.litigation();
        defendantProxy.litigation();
    }
}
